//
//  MAKTableView.h
//  MAKCommon
//
//  Created by zhuwh on 2020/3/27.
//  Copyright © 2020 mark. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MAKMacros.h"

NS_ASSUME_NONNULL_BEGIN

@class MAKTableView;
@protocol MAKTableViewDelegate <NSObject>
@optional

- (void)mak_tableView:(MAKTableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath model:(id)model actionId:(NSInteger)actionId;
- (void)mak_tableView:(MAKTableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
- (BOOL)mak_tableView:(MAKTableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)mak_tableView:(MAKTableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
- (UITableViewCellEditingStyle)mak_tableView:(MAKTableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)mak_tableView:(MAKTableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)mak_tableView:(MAKTableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath model:(id)model;
- (NSString *)mak_tableView:(MAKTableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath;

- (UISwipeActionsConfiguration *)mak_tableView:(MAKTableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0));

@end

@protocol MAKTableViewScrollViewDelegate <NSObject>
@optional
- (void)mak_scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;

- (void)mak_scrollViewWillBeginDragging:(UIScrollView *)scrollView;

- (void)mak_scrollViewDidScroll:(UIScrollView *)scrollView;

- (void)mak_scrollViewDidEndDecelerating:(UIScrollView *)scrollView;

- (void)mak_scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
@end

@protocol MAKTableViewHeaderViewDelegate <NSObject>
@optional
- (UIView *)mak_tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;

- (CGFloat)mak_tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;

- (UIView *)mak_tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;

- (CGFloat)mak_tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
@end

@protocol MAKTableViewButtonOnClickDelegate <NSObject>

- (void)mak_inTableview:(UITableView *)tableView buttonEvent:(UIButton *)button model:(id)model index:(NSIndexPath *)indexPath actionId:(NSInteger)actionId;

@end

@protocol MAKTableViewHasCollectionViewDeletate <NSObject>

- (void)mak_tableViewCellHasCollectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath model:(id)model actionId:(NSInteger)actionId;

@end

@interface MAKTableView : UITableView

@property (nonatomic, strong) id data;
@property (nonatomic, assign) BOOL isOneRow MAKExtensionDeprecated("该方法已过期，请使用isGroup代替");
@property (nonatomic, assign) BOOL isGroup ;
@property (nonatomic, strong,readonly) NSMutableDictionary* extData ;

@property (nonatomic, weak) id<MAKTableViewDelegate> makDelegate;
@property (nonatomic, weak) id<MAKTableViewScrollViewDelegate> scrollDelegate;
@property (nonatomic, weak) id<MAKTableViewHeaderViewDelegate> headerViewDelegate;
@property (nonatomic, weak) id<MAKTableViewButtonOnClickDelegate> buttonClickDelegate;
@property (nonatomic, weak) id<MAKTableViewHasCollectionViewDeletate> hasCollectionViewDelegate;

-(NSInteger)getKeyWithSection:(NSInteger)section;

@end

NS_ASSUME_NONNULL_END
